<?php
include_once("../modules/checkA.php");
include_once("../../config.php"); 
$plate=select_one_line_all_items($table_Prefix."plate","mid = 'finance'");
?>


<?
//用来判断当前系统属于什么板块
$system_part = $plate['mid'];
include_once("select_datas.php");
?>

<?$department_list=select_lines_all_items($table_Prefix."department","nid desc","","0");?>
<?$employee_list=select_lines_all_items($table_Prefix."employee","nid desc","","0");

$new_employee_list=transform_2darray_in_1darray_with_new_key($employee_list,"nid","name");


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include_once(ROOT_PATH_.'/controlbase/modules/head.php'); ?>
</head>

<body>

<div id="topbar"><?php include ROOT_PATH_.'/controlbase/modules/topbar.php'; ?></div>

<div id="container" class="finance">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_.'/controlbase/modules/sidebar.php'; ?>
        </div>


<div id="content" >
<h1> 财务汇总 </h1>




<!-- 用$system_part .list_boxes来控制来到确认板块信息显示-->
<div class="list-box">


    <a href="statistic.php?nav-itemed=finance" class="layui-btn" lay-submit lay-filter="formMemberAdd" >财务统计表</a>



    <div class="statistic">







        <div class="select-box layui-form">
            <form action="detail-list.php" >

                <div class="layui-form-item">
                    <label class="layui-form-label">关键词</label>
                    <div class="layui-input-block">
                        <input type="text" name="select_keywords" placeholder="可搜索内容，备注" autocomplete="off" class="layui-input" value="<? echo $_REQUEST['select_keywords']?>" >
                    </div>
                </div>



                <div class="layui-form-item">
                    <label class="layui-form-label">类型</label>
                    <div class="layui-input-block">
                        <select name="select_type"><i class="layui-icon"></i>>
                            <?if($_REQUEST['select_type']){echo "<option value='".$_REQUEST['select_type']."'>".$_REQUEST['select_type']."</option>";}?>
                            <option value="全部">全部</option>
                            <option value="维修费">维修费</option>
                            <option value="零件购买">零件购买</option>
                            <option value="购买保险">购买保险</option>
                            <option value="业务费">业务费</option>
                            <option value="设备购置费">设备购置费</option>
                            <option value="业务招待费">业务招待费</option>
                            <option value="办公用品">办公用品</option>
                            <option value="其他">其他</option>
                        </select>
                    </div>
                </div>





                <?
                $department_list=select_lines_all_items($table_Prefix."department","nid desc","","0");
                $department=select_one_line_all_items($table_Prefix."department","nid = '".$_REQUEST['select_departmentid']."'");
                ?>


                <div class="layui-form-item">
                    <label class="layui-form-label">网点</label>
                    <div class="layui-input-block">
                        <select name="select_departmentid" lay-verify="required" >


                            <?
                            if(($_REQUEST['select_departmentid']!='全部')&&($_REQUEST['select_departmentid']))
                            {echo "<option value='".$_REQUEST['select_departmentid']."'>".$department['name']."</option>";}
                            ?>


                            <option value="全部">全部</option>



                            <?for($i=0;$i<count($department_list);$i++){?>
                                <option value="<? echo $department_list[$i]['nid'] ?>"><? echo $department_list[$i]['name'];?></option>
                                <? ;} ?>
                        </select>
                    </div>
                </div>



                <div class="layui-form-item">
                    <label class="layui-form-label">时间</label>

                    <div class="layui-input-block">
                        <input type="text" name="select_startday" placeholder="请输入开始时间" autocomplete="off" class="layui-input"  onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" style="float: left; width: 112px" value="<?if($_REQUEST['select_startday']){echo $_REQUEST['select_startday'] ;} ?>" >

                        <span style="float: left;margin: 0 4px; line-height: 30px;">-</span>


                        <input type="text" name="select_endday" placeholder="请输入结束时间" autocomplete="off" class="layui-input" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"  style="float: left; width:112px" value="<?if($_REQUEST['select_endday']){echo $_REQUEST['select_endday'] ;} ?>"  >


                        <input type="hidden" name="nav-itemed"  value="finance" >


                    </div>


                </div>


                <br class="clearfloat"/>




                <button class="layui-btn">查找</button>
                <a class="layui-btn" href="export-finance-by-search.php?nowpageid=<?echo $url_str?>" target="_blank">导出当前数据</a>




                <br class="clearfloat"/>
            </form>

            <br class="clearfloat"/>
        </div>








    </div>


<script>



</script>



    <div class="list-boxes layui-form">

<br class="clearfloat"/>





<table class="layui-table">
  <colgroup>
    <col width="100">
    <col width="150">
	<col > 
	<col > 
	<col > 
	<col > 
	<col > 
	<col > 
	<col width="75">
	<col width="100">
	<col width="290">
  </colgroup>


    <style>
        .plgz{
            display: inline-block;
            height: 38px;
            line-height: 38px;
            padding: 0 18px;
            background-color: #ff9900;
            color: #fff;
            white-space: nowrap;
            text-align: center;
            font-size: 14px;
            border: none;
            border-radius: 2px;
            cursor: pointer;
            opacity: .9;
            filter: alpha(opacity=90);
        }
        .plguozhang:hover{
            border-color: #ff9900;
            color: #333;
        }
    </style>
    <form action="detail-piliangguozhang.php?&nowpageid=<?echo $nowpageid?>" method="post">
        <button class="plgz">批量过账</button>

        <thead>
    <tr>

      <th><span onclick="quanxuan()">全选 </span>序号</th>
      <th>内容</th>
      <th>金额</th>
      <th>用款人</th>
      <th>部门</th>
      <th>录入</th>
      <th>类型</th>
      <th>日期</th>
      <th>状态</th>
      <th>备注</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>


  <?php

 
  if ($detailnum == 0) {
      echo "数据添加中";
  }

  ?>

  <?php
	for ($i = 0; $i < $detailnum; $i++) {
    ?>
        <!--//查看这条信息有无修改申请，有的话就变色，提示修改中-->
        <? $applymodify=select_one_line_all_items($table_Prefix."finance","rid='".$detail[$i]['nid']."' and applystatus='申请修改'") ;?>


<tr id="item<?echo $detail[$i]['nid']?>" <?if($applymodify['nid']){echo "style='color:red'";$status=" / 审核中";}else{$status="";}?>>

      <td>

          <?if(!$applymodify['nid']){?>



          <input name="plguozhang[<?echo $i?>]" type="checkbox" value="<?echo $detail[$i]['nid']?>"><?echo $i+1+$plate['page_list_num']*($nowpageid-1) ?>

              <?;}?></td>

      <td><?echo $detail[$i]['name']?></td>
      <td><?echo $detail[$i]['cost']?></td>
      <td><?echo $new_employee_list[$detail[$i]['principal']]?></td>


      <? $department=select_one_line_all_items($table_Prefix."department","nid = '".$detail[$i]['departmentid']."'")?>
	  <td><?echo $department['name']?></td>

        <? $authurname=select_one_line_all_items($table_Prefix."employee","nid = '".$detail[$i]['authur']."'")?>
        <td><?echo $authurname['name']?></td>
	  <td><?echo $detail[$i]['classify']?></td>
	  <td><?echo $detail[$i]['applydate']?></td>
	  <td> <?echo $detail[$i]['status']?></td>
	  <td><?echo $detail[$i]['remark']?></td>
	  <td>







<?if(($_SESSION['mid']=="admin")&&($detail[$i]['status']!="过账")){?>
    <a href="detail-edit.php?nav-itemed=<?echo $system_part?>&nid=<? echo $detail[$i]['nid']?>&nowpageid=<?echo $nowpageid?>" class="layui-btn layui-btn-primary layui-btn-small" >
        <i class="layui-icon">&#xe642;</i>修改</a>
    <?;}else if($detail[$i]['status']!="过账"){?>
          <!--          普通员工修改-->
          <a href="detail-add-edit.php?nav-itemed=<?echo $system_part?>&nid=<? echo $detail[$i]['nid']?>&nowpageid=<?echo $nowpageid?>" class="layui-btn layui-btn-primary layui-btn-small" >
              <i class="layui-icon">&#xe642;</i>修改
<?}?>







              <?if($detail[$i]['status']!="过账"){?>

      <a href="javascript:void(0)" onclick="delItem (<?php echo $detail[$i]['nid']?>)" class="delete layui-btn layui-btn-primary layui-btn-small" > <i class="layui-icon">&#xe640;</i> 删除 </a><?}?>



              <?if($_SESSION['position']=="出纳"){?>
                  <a  href="detail-verify-status.php?nav-itemed=<?echo $system_part?>&nid=<? echo $detail[$i]['nid']?>&status=<?echo $detail[$i]['status']?>&nowpageid=<?echo $nowpageid?>" class="layui-btn layui-btn-primary layui-btn-small">
                      <?
                      if($detail[$i]['status']!="过账"){echo "过账";}
                      else{echo "取消过账";}
                      ?>
                  </a>
              <?}?>




              <? if((($_SESSION['mid']=="admin")||($_SESSION['mid']=="finance"))&&($applymodify['nid'])){ ;?>
                  <a href="detail-verify.php?nav-itemed=<?echo $system_part?>&nid=<? echo $detail[$i]['nid']?>" class="layui-btn layui-btn-primary layui-btn-small">审核修改</a>
                  <?;}?>






  </td> 
    </tr>
  <?php

}
?>

 
  </tbody>
    </form>
</table>




 

</div>


<div class="list-box-function" <? if ($detailnum == 0) {
    echo "style" . "='display:none'";
} ?> >
    <div class="page-guide">

        <?php
        if ($nowpageid == 1) {
            ?>
            <!--现在页数在第一页的时候-->
            <span>首页</span>
            <span>前一页</span>
            <!--现在页数非第一页的时候-->
        <?php
        } else {
            ?>
            <!--现在页数非第一页的时候-->
            <a href="detail-list.php?sortby=<?php echo $sort_by; ?>&nid=<?php echo $trans_nid ?>&sys_part=<? echo $system_part ?>&nav-itemed=<?echo $_GET["nav-itemed"]?>">首页</a>
            <a href="detail-list.php?nowpageid=<?php echo $prepage; ?>&sortby=<?php echo $sort_by; ?>&nid=<?php echo $trans_nid ?>&sys_part=<? echo $system_part ?>&nav-itemed=<?echo $_GET["nav-itemed"]?>">前一页</a>
            <!--现在页数非第一页的时候-->
        <?php
        }
        ?>


        <!--开始列印出所有页码-->

        <?php
        $ii = 1;
        $iii = 1;

        while ($ii <= $page_count) {
            //首先判断是不是当前页

            if ($ii == $nowpageid) {
                echo "<span>" . $ii . "</span>";
            } else if ((($ii + 5) < $nowpageid) || (($ii - 5) > $nowpageid)) {
            } else {
                echo "<a href='";
                echo "detail-list.php?nowpageid=";
                echo $iii;
                echo "&sortby=";
                echo $sort_by;
                echo "&nid=";
                echo $trans_nid;
                echo "&sys_part=";
                echo $system_part;
                echo $url_str;
                echo "&nav-itemed=";
                echo $_GET['nav-itemed'];
                echo "'>";
                echo $iii;
                echo "</a>";
            }

            $ii++;
            $iii++;
        }
        ?>

        <!--列印出所有页码 结束-->


        <?php
        if ($nowpageid == $page_count) {
            ?>
            <!--现在页数在第一页的时候-->
            <span>后一页</span>
            <span>末页</span>
            <!--现在页数非第一页的时候-->
        <?php
        } else {
            ?>
            <!--现在页数非第一页的时候-->
            <a href="detail-list.php?nowpageid=<?php echo $nextpage; ?>&sortby=<?php echo $sort_by; ?>&nid=<?php echo $trans_nid ?>&sys_part=<? echo $system_part ?>&nav-itemed=<?echo $_GET["nav-itemed"]?>">后一页</a>
            <a href="detail-list.php?nowpageid=<?php echo $lastpage; ?>&sortby=<?php echo $sort_by; ?>&nid=<?php echo $trans_nid ?>&sys_part=<? echo $system_part ?>&nav-itemed=<?echo $_GET["nav-itemed"]?>">末页</a>
            <!--现在页数非第一页的时候-->
        <?php
        }
        ?>


    </div>
    <!--翻页代码结束-->
</div>


<!--list-boxes end-->
</div>
<!--list-box end-->
</div>

<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>



<?php include_once('../modules/footer.php'); ?>




</body>
</html>

 pt>